<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>文章类别管理</title>
    <!-- 导入layui样式文件 -->
    <link rel="stylesheet" href="/assets/lib/layui/css/layui.css" />
    <!-- 导入自己的art_cate样式文件 -->
    <link rel="stylesheet" href="/assets/css/atricle/art_cate.css" />
</head>

<body>
    <div class="layui-card">
        <div class="layui-card-header"><span>文章类别管理</span><button class="layui-btn layui-btn-normal addCateBtn">添加类别</button></div>
        <div class="layui-card-body">
            <table class="layui-table">
                <colgroup>
                    <col>
                    <col width="500">
                    <col width="300">
                </colgroup>
                <thead>
                    <tr>
                        <th>分类名称</th>
                        <th>分类别名</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody id="art_content">

                </tbody>
            </table>
        </div>
    </div>
    <div class="amend">

    </div>
    <!-- 添加类别的弹出窗口导入的标签框架  这样就省去了在js中写标签的不方便性-->
    <script type="text/html" id="dialog-add">
        <form class="layui-form" id="form-add">
            <div class="layui-form-item">
                <label class="layui-form-label">分类名称</label>
                <div class="layui-input-block">
                    <input type="text" name="name" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">分类别名</label>
                <div class="layui-input-block">
                    <input type="text" name="alias" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="formDemo">确认添加</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </script>
    <!-- 编辑的弹出窗口导入的标签框架 -->
    <script type="text/html" id="dialog-complie">
        <form class="layui-form" id="form-complie" lay-filter="formComplie">
            <!-- 这里放了一个隐藏的input控件，为的是用于存储进行数据更新时需要的对应类别的id数据 因为发起请求必须要用到id-->
            <input type="hidden" name="Id">
            <div class="layui-form-item">
                <label class="layui-form-label">分类名称</label>
                <div class="layui-input-block">
                    <input type="text" name="name" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">分类别名</label>
                <div class="layui-input-block">
                    <input type="text" name="alias" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn btnAffirm " lay-submit lay-filter="formDemo">确认修改</button>

                </div>
            </div>
        </form>
    </script>

    <!-- 配置模版结构 -->
    <script type="text/html" id="tpl-table">
        {{each data}}
        <tr>
            <td>
                {{$value.name}}
            </td>
            <td>{{$value.alias}}</td>
            <td>
                <!-- 在渲染页面的时候就给编辑和删除按钮添加一个自定义属性，存放他们对应数据的id，方便后期需要的时候使用 -->
                <button class="layui-btn operation_btn btnComplie" data-id="{{$value.Id}}">编辑</button>
                <button class="layui-btn layui-btn-danger operation_btn btnDelete" data-id="{{$value.Id}}">删除</button>
            </td>
        </tr>
        {{/each}}
    </script>


    <!-- 导入layui的js文件 -->
    <script src="/assets/lib/layui/layui.all.js"></script>
    <!-- 导入jQuery文件 -->
    <script src="/assets/lib/jquery.js"></script>
    <!-- 导入需要统一挂载的ajax相关配置对象js文件 -->
    <script src="/assets/js/baseAPI.js"></script>
    <!-- 导入模版引擎js文件 -->
    <script src="/assets/lib/template-web.js"></script>
    <!-- 导入自己的art_cate相关js文件 -->
    <script src="/assets/js/article/art_cate.js"></script>
</body>

</html>